From 196be7c9deb94b133d2dfe6f762f02256ba383d9 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 20 Sep 2002 15:07:17 +0000 Subject: [PATCH] Holux changes from Jochen --- gpsbabel/holux.c | 22 ++++++++++++---------- gpsbabel/holux.h | 17 +++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/gpsbabel/holux.c b/gpsbabel/holux.c index 9d87f0127..2bcff3c79 100644 --- a/gpsbabel/holux.c +++ b/gpsbabel/holux.c @@ -126,7 +126,7 @@ static void data_read(void) wpt_tmp->creation_time = 0; if (pWptHxTmp->date.year) { - ptm = gmtime(&pWptHxTmp->time); + ptm = gmtime((time_t*)&pWptHxTmp->time); tm.tm_hour = ptm->tm_hour; tm.tm_min = ptm->tm_min; tm.tm_sec = ptm->tm_sec; @@ -189,7 +189,9 @@ static void holux_disp(const waypoint *wpt) sIndex = ((WPTHDR *)HxWFile)->num; ((WPTHDR *)HxWFile)->idx[sIndex] = sIndex; /* set the waypoint index */ + ((WPTHDR *)HxWFile)->used[sIndex] = 0xff; /* Waypoint used */ + /* set Waypoint */ pWptHxTmp = (WPT *)&HxWFile[OFFS_WPT + (sizeof(WPT) * sIndex)]; @@ -206,7 +208,7 @@ static void holux_disp(const waypoint *wpt) /*set the time */ if (wpt->creation_time) { - /* tm = gmtime(&wpt->creation_time); /* I get the wrong result with gmtime ??? */ + /* tm = gmtime(&wpt->creation_time);*/ /* I get the wrong result with gmtime ??? */ tm = localtime(&wpt->creation_time); pWptHxTmp->time = (tm->tm_hour * 3600) + (tm->tm_min * 60) +tm->tm_sec; pWptHxTmp->date.day = tm->tm_mday; @@ -225,9 +227,9 @@ static void holux_disp(const waypoint *wpt) pWptHxTmp->pt.iLatitude = (int)lat; pWptHxTmp->pt.iLongitude = (int)lon; pWptHxTmp->checked = 01; - + pWptHxTmp->vocidx = (short)0xffff; ((WPTHDR *)HxWFile)->num = ++sIndex; - ((WPTHDR *)HxWFile)->next= sIndex; + ((WPTHDR *)HxWFile)->next= ++sIndex; } @@ -248,7 +250,7 @@ static void data_write(void) /* clear index list */ for (sCount = 0; sCount < MAXWPT; sCount++) - ((WPTHDR *)HxWFile)->idx[sCount] = (short)0xffff; + ((WPTHDR *)HxWFile)->idx[sCount] = (signed short)-1; for (sCount = 0; sCount < MAXWPT; sCount++) ((WPTHDR *)HxWFile)->used[sCount] = 0; @@ -256,13 +258,13 @@ static void data_write(void) /* init the route area */ ((RTEHDR *)&HxWFile[ROUTESTART])->id = RTE_HDR_ID; ((RTEHDR *)&HxWFile[ROUTESTART])->num = 0; - ((RTEHDR *)&HxWFile[ROUTESTART])->next = 0; - ((RTEHDR *)&HxWFile[ROUTESTART])->rteno = 0; + ((RTEHDR *)&HxWFile[ROUTESTART])->next = 1; + ((RTEHDR *)&HxWFile[ROUTESTART])->rteno = (signed short)-1; /* clear index list */ - for (sCount = 0; sCount < MAXWPT; sCount++) - ((RTEHDR *)&HxWFile[ROUTESTART])->idx[sCount] = (short)0xffff; - for (sCount = 0; sCount < MAXWPT; sCount++) + for (sCount = 0; sCount < MAXRTE; sCount++) + ((RTEHDR *)&HxWFile[ROUTESTART])->idx[sCount] = (signed short)-1; + for (sCount = 0; sCount < MAXRTE; sCount++) ((RTEHDR *)&HxWFile[ROUTESTART])->used[sCount] = 0; diff --git a/gpsbabel/holux.h b/gpsbabel/holux.h index 25fb2af5b..cab9e077c 100644 --- a/gpsbabel/holux.h +++ b/gpsbabel/holux.h @@ -33,7 +33,8 @@ #endif -#define GM100_WPO_FILE_SIZE 25512 /* size of a holux gm-100 wpo file */ +/* #define GM100_WPO_FILE_SIZE 25512 */ /* size of a holux gm-100 wpo file used by mapShow 1.4*/ +#define GM100_WPO_FILE_SIZE 25600 /* size of a holux gm-100 wpo file used by the GM-100*/ #define ROUTESTART 23600 /* Offset for start of route */ #define MAXWPT 500 /* max number of waypoint */ @@ -84,7 +85,7 @@ typedef struct tagWPT POINT pt; /* waypoint location */ short vocidx; /* voice index, not used */ short usecount; /* counter: times used by routes */ - HX_DATE date; /* date */ + HX_DATE date; /* date */ unsigned time; /* time */ char checked; /* Active or not */ BYTE dummy[3]; /* fill bytes */ @@ -94,12 +95,12 @@ typedef struct tagWPT typedef struct tagRTEHDR { - DWORD id; /* RTE_HDR_ID */ - short num; /* Current route number */ - short next; /* next route number */ - short idx[MAXRTE]; /* saving route index here for each route, default was -1 */ - BYTE used[MAXRTE]; /* Have the wpt been used (0xFF), Default was 0 */ - short rteno; /* Saving navigationroute number here */ + DWORD id; /* RTE_HDR_ID */ + short num; /* Current route number */ + short next; /* next route number */ + signed short idx[MAXRTE]; /* saving route index here for each route, default was -1 */ + BYTE used[MAXRTE]; /* Have the wpt been used (0xFF), Default was 0 */ + signed short rteno; /* Saving navigationroute number here */ }RTEHDR; -- 2.30.2